import 'package:json_annotation/json_annotation.dart';

import '../user/xmm_wall_user.dart';

part 'xmm_article_info.g.dart';

@JsonSerializable()
class XmmArticleInfo {
  ///作者
  String? author;

  ///关注人数
  int? followed;

  ///作品数量
  int? count;

  ///作品标题
  String? title;

  ///作品封面
  String? thumbnail;

  ///作品内容列表
  List<String>? content;

  ///作品描述
  String? description;

  ///绑定的用户数据
  XmmWallUser? wallUser;

  ///是否已点赞
  bool? isLikeByMe;

  ///评论列表
  List<XmmArticleComment>? commentList;

  XmmArticleInfo({
    this.author,
    this.followed,
    this.count,
    this.title,
    this.thumbnail,
    this.content,
    this.description,
    this.wallUser,
    this.isLikeByMe,
    this.commentList,
  });

  factory XmmArticleInfo.fromJson(Map<String, dynamic> json) =>
      _$XmmArticleInfoFromJson(json);

  Map<String, dynamic> toJson() => _$XmmArticleInfoToJson(this);
}

@JsonSerializable()
class XmmArticleComment {
  String? avatar;
  String? nickname;
  String? content;

  XmmArticleComment({
    this.content,
    this.nickname,
    this.avatar,
  });

  factory XmmArticleComment.fromJson(Map<String, dynamic> json) =>
      _$XmmArticleCommentFromJson(json);

  Map<String, dynamic> toJson() => _$XmmArticleCommentToJson(this);
}
